﻿using Direct.IDAL.Manager.Notice;
using DirectSell.Common.Filter;
using DirectSell.Common.Http;
using DirectSell.Common.Page;
using DirectSell.Common.Url;
using DirectSell.Model.ManagerNotice;
using DirectSell.Model.Query;
using Microsoft.Practices.Unity;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace DirectSell.WebLayer.Areas.User.Controllers
{
    /// <summary>
    /// 公告
    /// </summary>
    public class NoticeController : Controller
    {
        #region 注入
        [Dependency]
        protected INoticeManagerRepository _repository { get; set; }
        #endregion

        #region 首页
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        [LoginFilter(IsCheck = true)]
        public async Task<ActionResult> Index(BaseCondition condition)
        {
            var list = await _repository.GetList(condition);
           // var pagelist = await list.ToPageListAsync(page);
            return View(list);
        }
        #endregion

        #region 查询一条公告
        /// <summary>
        /// 查询一条公告
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult NoticeInfo(int id)
        {
            var model = _repository.QueryNotice(id);
            return View(model);
        }
        #endregion
    }
}